package com.zeno.soil.rbac.config;

import com.alibaba.druid.pool.DruidDataSource;
import com.zeno.web.core.exception.WafExceptionResolveHandler;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author zeno
 */
@Configuration
@MapperScan(basePackages = "com.zeno.soil.rbac.repository")
public class DataSourceConfig {

	@Bean(destroyMethod = "close")
	@ConfigurationProperties(prefix = "soil-rbac.datasource")
	public DruidDataSource datasource(){
		return new DruidDataSource();
	}

	@Bean
	public WafExceptionResolveHandler exceptionResolveHandler(){
		return new WafExceptionResolveHandler();
	}

}
